import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { FileModule } from "./file.module";

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: "postgres",
      host: process.env.PG_HOST || "localhost",
      port: parseInt(process.env.PG_PORT || "5432"),
      username: process.env.PG_USER || "root",
      password: process.env.PG_PASSWORD || "Letusdoit000",
      database: process.env.PG_DATABASE || "app",
      entities: [__dirname + "/**/*.entity{.ts,.js}"],
      synchronize: true, // 开发环境使用，生产环境请关闭
    }),
    FileModule,
  ],
})
export class AppModule {}
